package word511;

import java.util.ArrayList;

public class TestPrint {
    private static Object ArrayList;

    public static void main(String[] args) {
        //新建两个Runnable接口的任务，PrintString类是基于Runnable接口的
        // 接受两个参数，第一个是字符串，第二个是整型，也是打印第一个参数的数量
        Runnable printgreet = new PrintString("你好啊",50);
        Runnable printsee = new PrintString("再见~",50);


        //新建两个Runnable接口的任务，PrintStu类是基于Runnable接口的
        //接受三个参数，第一个是姓名，第二个是性别，第三个是年龄，run方法里面是打印其信息
        Runnable stu1 = new PrintStu("魏十一","男","18");
        Runnable stu2 = new PrintStu("老丘","男","22");
        Runnable stu3 = new PrintStu("邱小烽","男","19");
        //新建Runnable类型的列表，里面放入三个任务
        ArrayList<Runnable> student = new ArrayList<>();
        student.add(stu1);
        student.add(stu2);
        student.add(stu3);

        //读取每个任务，并把它放在线程里面进行运行
//        for (Runnable stu:student
//             ) {
//            Thread thread  = new Thread(stu);
//            thread.start();
//        }




        //将两个打印字符串任务，并把它放在线程里面进行运行
        Thread thread1  = new Thread(printgreet);
        thread1.start();

//        Thread thread2  = new Thread(printsee);
//        thread1.start();
//        thread2.start();

    }
}
